package com.jblv.frame;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.Arrays;

/**
 * @author happyonion.yangtao
 * @Title: JblvWebApplication
 * @ProjectName jblv-frame
 * @PackageName com.jblv.web
 * @Description
 * @date Create at 2020/4/10 16:00
 */
@SpringBootApplication(scanBasePackages = {"com.jblv.frame","com.jblv.frame.common.handler"},exclude= {DataSourceAutoConfiguration.class})
@ServletComponentScan
@ImportResource("classpath:consumer.xml")
public class WebApplication {
    private final static Logger logger = LoggerFactory.getLogger(WebApplication.class);

    public static void main(String[] args) {
        long beginT = System.currentTimeMillis();
        logger.info("begin:"+beginT);
        SpringApplication app = new SpringApplication(WebApplication.class);
        app.setBannerMode(Banner.Mode.OFF);
        ApplicationContext context  = app.run(args);
        logger.info("Web启动成功,启动共用"+(System.currentTimeMillis()-beginT )+"ms");
//        Arrays.stream(context.getBeanDefinitionNames()).forEach(System.out::println);
    }

}
